package cz.muni.fi.pv168.realestate;

import java.util.List;

/**
 * OwnerManager interface
 * 
 * @author morty
 *
 */
public interface OwnerManager {

	/**
	 * Stores new owner into database. Id for new owner is automatically 
	 * generated and stored into id attribute
	 * 
	 * @param owner	owner to be created
	 * @throws IllegalArgumentException when owner is null or if owner has 
	 * already assigned id
	 * @throws ServiceFailureException when db operation fails
	 * 
	 */
	void createOwner(Owner owner) throws ServiceFailureException;
	
	/**
	 * Deletes owner from database
	 * 
	 * @param owner owner to be deleted
	 * @throws IllegalArgumentException when owner is null or if owner has 
	 * already assigned id
	 * @throws ServiceFailureException when db operation fails
	 */
	void deleteOwner(Owner owner) throws ServiceFailureException;
	
	/**
	 * Updates owner in database
	 * 
	 * @param owner to be updated
	 * @throws IllegalArgumentException when owner is null or if owner has 
	 * already assigned id
	 * @throws ServiceFailureException when db operation fails
	 */
	void updateOwner(Owner owner) throws ServiceFailureException;
	 
	/**
	 * Returns owner with given id
	 * 
	 * @param id primary key of requested owner
	 * @return owner with given id or null if owner does not exist
	 * @throws IllegalArgumentException when given id is null
	 * @throws ServiceFailureException when db operation fails
	 */
	Owner getOwnerById(Long id) throws ServiceFailureException;
	
	/**
	 * Returns list of all owners in database
	 * @return list of all owners in database
	 * @throws ServiceFailureException when db operation fails
	 */
	List<Owner> getAllOwners() throws ServiceFailureException;
}
